import 'package:get/get.dart';
import 'package:yp/services/api.dart';

import 'state.dart';

class AgreementLogic extends GetxController {
  final state = AgreementState();

  @override
  void onInit() {
    super.onInit();
    state.type = Get.arguments["type"] ?? 1;
    Api.agreement().listen((event) {
      if (event["code"] == 0) {
        state.content = state.type == 1
            ? event["register_agreement"]
            : event["privacy_agreement"];
        update();
      }
    });
  }
}
